using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;

using Pervote.Core;
using Pervote.Core.Logic;

public partial class _Perverts_CreateCategory : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {

    }
    protected void Button1_Click(object sender, EventArgs e)
    {
        MembershipUser user = Membership.GetUser();
        if (user != null)
        {
            if (user.UserName != "admin") Response.Redirect("/");
            else
            {
                CategoryManager catMan = new CategoryManager();
                Category category = new Category();
                category.Name = catTextBox.Text;
                category.Description = "";
                category.CreatedBy = "admin";
                category.ParentId = 1;
                catMan.CreateCategory(category, new ErrorInfo());
            }
        }
        else
        {
            Response.Redirect("/");
        }
    }
}
